//  PULSAR, THE GAME
//  ================================
//  COPYRIGHT(c) 2013 BY KAMIL MRZYGŁÓD
//  CODENOVA.PL

define(['../Core', '../Stylus'], function (Core, Stylus) {
    var Block = function(styleName) {
        this.Background = Stylus[styleName].Background;
        this.BorderColor = Stylus[styleName].BorderColor;
        this.BorderWidth = Stylus[styleName].BorderWidth;
        this.ElementType = 'block';
        this.ElementId = Core.GenerateUUID();
        this.Height = Stylus[styleName].Height;
        this.Width = Stylus[styleName].Width;
        this.X = Stylus[styleName].X;
        this.Y = Stylus[styleName].Y;
    };

    Block.prototype = {
        Add: function() {
            // Draw block
            Core.DrawRectangle(this.Context, this.X, this.Y, this.Width, this.Height, this.Background, this.BorderColor, this.BorderWidth);
        },

        Create: function(styleName) {
            return new Block(styleName);
        },

        Initialize: function() {
            var canvas;

            // Create canvas for Block
            Core.CreateHtmlElement('canvas', {
                'data-id': this.Id,
                'data-element-type': this.ElementType,
                'height': this.Height,
                'id': this.ElementId,
                'width': this.Width
            });

            // Get canvas and context
            Core.GetCanvasAndContext(this);
        }
    };

    return Block.prototype.Create;
});